/*
 *  player_configure.h
 *  ICE_Player
 *
 *  Created by xl on 11-7-3.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef PLAYER_CONFIGURE_H_
#define PLAYER_CONFIGURE_H_

#ifdef __cplusplus
extern "C"{
#endif

#ifndef bool
#define bool char
#endif
	
#ifndef true
#define true 1
#endif
	
#ifndef false
#define false 0
#endif
	
#define CFG_SECTION_TAG "Configure"
#define CFG_IS_ROTATION_LOCKED "Locked_Rotation"
#define CFG_ENABLE_SUBTITLE "Enable_Subtitle"
#define CFG_ENABLE_TEXT_INFO "Enable_Text_Info"
#define CFG_LOOP_MODE "Loop_Mode"
#define CFG_IS_FILES_LOCKED "Files_Locked"
#define CFG_PASSWORD "Pass_Word"
#define CFG_YES "YES"
#define CFG_NO "NO"
#define CFG_MAX_STR_LEN (10240)
#define CFG_MAX_PATH_LEN (1024)
#define CFG_MAX_PSW_LEN (20)
#define CFG_PSW_LEN (6)
    
typedef enum eLOOP_MODE{
    E_LM_NO_LOOP = 0,
    E_LM_SINGLE_LOOP,
    E_LM_LIST_LOOP,
    E_LM_RANDOM,
    E_LM_COUNT,
} E_LOOP_MODE;

typedef struct tagICE_CONFIG{
    bool is_files_locked;
	bool is_rotation_locked;
    bool enable_subtitle;
    bool enable_text_info;
    E_LOOP_MODE loop_mode;
    char pass_word[CFG_MAX_PSW_LEN];
	void* reserved;
}ICE_CONFIG;
	
ICE_CONFIG* icfg_create_configure();
bool icfg_get_configure_from_file(ICE_CONFIG* p_cfg, char* path);
bool icfg_put_configure_to_file(ICE_CONFIG* p_cfg, char* path);
void icfg_release_configure(ICE_CONFIG* p_cfg);
    
char* icfg_get_app_home_path();
	
#define SAFE_ALLOC_ICFG(p) {p = icfg_create_configure();}
#define SAFE_FREE_ICFG(p) {p = icfg_release_configure(); p = NULL;}
	
#ifdef __cplusplus
};
#endif

#endif /* end of #ifndef PLAYER_CONFIGURE_H_ */